﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace ProgramDemoForModelling.CheckValidation
{
    class CheckValidationCar
    {
        #region Field

        private bool[] m_checkAll;

        private Regex m_nameEx;

        private string str = "|á|à|ả|ã|ạ|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ|" +
                             "đ|" +
                             "é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ|" +
                             "í|ì|ỉ|ĩ|ị|" +
                             "ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ|" +
                             "ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự|" +
                             "ý|ỳ|ỷ|ỹ|ỵ" +
                             "|,|.|;|/|Á|À|Ả|Ã|Ạ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|" +
                             "Đ|" +
                             "É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ|" +
                             "Í|Ì|Ỉ|Ĩ|Ị|" +
                             "Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ|" +
                             "Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự|" +
                             "Ý|Ỳ|Ỷ|Ỹ|Ỵ|";

        #endregion

        #region Properties

        public bool CheckNumberPlate(string _numberplate)
        {
            if (_numberplate == "" || _numberplate == null)
            {
                m_checkAll[0] = false;
                return false;
            }

            m_checkAll[0] = true;
            return true;
        }

        public bool CheckNameCustomer(string _nameCustomer)
        {
            if (_nameCustomer == "" || _nameCustomer == null)
            {
                m_checkAll[1] = false;
                return false;
            }

            m_checkAll[1] = true;
            return true;
        }

        public bool CheckAddress(string _address)
        {
            if (_address == "" || _address == null)
            {
                m_checkAll[2] = false;
                return false;
            }

            m_checkAll[2] = true;
            return true;
        }

        public bool CheckNumberPhone(string _numberPhone)
        {
            if (_numberPhone == null || _numberPhone == "")
            {
                m_checkAll[3] = false;
                return false;
            }

            m_checkAll[3] = true;
            return true;
        }

        public bool CheckEmail(string _email)
        {
            if (_email == null || _email == "")
            {
                m_checkAll[4] = false;
                return false;
            }

            m_checkAll[4] = true;
            return true;
        }

        public bool CheckAllCar()
        {
            int i = 0;
            while (i < 5)
            {
                if (m_checkAll[i] == false)
                {
                    return false;
                }
                ++i;
            }

            return true;
        }

        public void SetAllCheckFalse()
        {
            m_checkAll[0] = false;
            m_checkAll[1] = false;
            m_checkAll[2] = false;
            m_checkAll[3] = false;
            m_checkAll[4] = false;
        }

        public void SetAllCheckTrue()
        {
            m_checkAll[0] = true;
            m_checkAll[1] = true;
            m_checkAll[2] = true;
            m_checkAll[3] = true;
            m_checkAll[4] = true;
        }

        #endregion

        #region Initialization

        public CheckValidationCar()
        {
            m_nameEx = new Regex("");
            m_checkAll = new bool[5] { false, false, false, false, false };
        }

        #endregion
    }
}
